

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>ceph-objectstore-tool -- 修改或检查一个 OSD 的状态 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">ceph-objectstore-tool -- 修改或检查一个 OSD 的状态</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/man/8/ceph-objectstore-tool.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="ceph-objectstore-tool-osd">
<h1>ceph-objectstore-tool -- 修改或检查一个 OSD 的状态<a class="headerlink" href="#ceph-objectstore-tool-osd" title="Permalink to this heading"></a></h1>
<section id="id1">
<h2>提纲<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<div class="line-block">
<div class="line"><strong>ceph-objectstore-tool</strong> --data-path <em>path to osd</em> [--op <em>list</em> ]</div>
</div>
<p>支持的对象操作：</p>
<ul class="simple">
<li><p>(get|set)-bytes [file]</p></li>
<li><p>set-(attr|omap) [file]</p></li>
<li><p>(get|rm)-attr|omap)</p></li>
<li><p>get-omaphdr</p></li>
<li><p>set-omaphdr [file]</p></li>
<li><p>list-attrs</p></li>
<li><p>list-omap</p></li>
<li><p>remove|removeall</p></li>
<li><p>dump</p></li>
<li><p>set-size</p></li>
<li><p>clear-data-digest</p></li>
<li><p>remove-clone-metadata</p></li>
</ul>
</section>
<section id="id2">
<h2>描述<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p><strong>ceph-objectstore-tool</strong> 工具是用于修改 OSD 状态的。它能够修改对象内容、删除对象、罗列 omap 、修改 omap 头部、修改 omap 键、罗列对象属性、修改对象属性键。</p>
<p><strong>ceph-objectstore-tool</strong> 有两个主要用法： (1) 指定了 “--op” 参数的模式（例如 <strong>ceph-objectstore-tool</strong> --data-path $PATH_TO_OSD --op $SELECT_OPERATION [--pgid $PGID] [--dry-run]），还有 (2) 定位对象操作，在此模式下，对象可以按 ID 或 <code class="docutils literal notranslate"><span class="pre">--op</span> <span class="pre">list</span></code> 的 JSON 格式输出来指定。</p>
<div class="line-block">
<div class="line"><strong>ceph-objectstore-tool</strong> --data-path <em>path to osd</em> [--pgid <em>$PG_ID</em> ][--op <em>command</em>]</div>
<div class="line"><strong>ceph-objectstore-tool</strong> --data-path <em>path to osd</em> [ --op <em>list $OBJECT_ID</em>]</div>
</div>
<p>支持的 --op 命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">*</span> <span class="n">info</span>
<span class="o">*</span> <span class="n">log</span>
<span class="o">*</span> <span class="n">remove</span>
<span class="o">*</span> <span class="n">mkfs</span>
<span class="o">*</span> <span class="n">fsck</span>
<span class="o">*</span> <span class="n">repair</span>
<span class="o">*</span> <span class="n">fuse</span>
<span class="o">*</span> <span class="n">dup</span>
<span class="o">*</span> <span class="n">export</span>
<span class="o">*</span> <span class="n">export</span><span class="o">-</span><span class="n">remove</span>
<span class="o">*</span> <span class="kn">import</span>
<span class="o">*</span> <span class="nb">list</span>
<span class="o">*</span> <span class="nb">list</span><span class="o">-</span><span class="n">slow</span><span class="o">-</span><span class="n">omap</span>
<span class="o">*</span> <span class="n">fix</span><span class="o">-</span><span class="n">lost</span>
<span class="o">*</span> <span class="nb">list</span><span class="o">-</span><span class="n">pgs</span>
<span class="o">*</span> <span class="n">dump</span><span class="o">-</span><span class="nb">super</span>
<span class="o">*</span> <span class="n">meta</span><span class="o">-</span><span class="nb">list</span>
<span class="o">*</span> <span class="n">get</span><span class="o">-</span><span class="n">osdmap</span>
<span class="o">*</span> <span class="nb">set</span><span class="o">-</span><span class="n">osdmap</span>
<span class="o">*</span> <span class="n">get</span><span class="o">-</span><span class="n">superblock</span>
<span class="o">*</span> <span class="nb">set</span><span class="o">-</span><span class="n">superblock</span>
<span class="o">*</span> <span class="n">get</span><span class="o">-</span><span class="n">inc</span><span class="o">-</span><span class="n">osdmap</span>
<span class="o">*</span> <span class="nb">set</span><span class="o">-</span><span class="n">inc</span><span class="o">-</span><span class="n">osdmap</span>
<span class="o">*</span> <span class="n">mark</span><span class="o">-</span><span class="n">complete</span>
<span class="o">*</span> <span class="n">reset</span><span class="o">-</span><span class="n">last</span><span class="o">-</span><span class="n">complete</span>
<span class="o">*</span> <span class="n">update</span><span class="o">-</span><span class="n">mon</span><span class="o">-</span><span class="n">db</span>
<span class="o">*</span> <span class="n">dump</span><span class="o">-</span><span class="n">export</span>
<span class="o">*</span> <span class="n">trim</span><span class="o">-</span><span class="n">pg</span><span class="o">-</span><span class="n">log</span>
</pre></div>
</div>
</section>
<section id="id3">
<h2>安装<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p><strong>ceph-objectstore-tool</strong> 在 <cite>ceph-osd</cite> 软件包里。</p>
</section>
<section id="id4">
<h2>实例<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<section id="id5">
<h3>对象的修改<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h3>
<p>这些命令可修改一个 OSD 的状态，使用 ceph-objectstore-tool 时这个 OSD 一定不能运行。</p>
</section>
<section id="id6">
<h3>罗列对象和归置组<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h3>
<p>确保目标 OSD 处于停机状态:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl status ceph-osd@$OSD_NUMBER
</pre></div>
</div>
<p>找出一个 OSD 内的所有对象:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --op list
</pre></div>
</div>
<p>找出一个归置组内的所有对象:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID --op list
</pre></div>
</div>
<p>找出一个对象所属的归置组（ PG ）:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --op list $OBJECT_ID
</pre></div>
</div>
</section>
<section id="id7">
<h3>丢失对象的修正<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h3>
<p>确保此 OSD 处于停机状态:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">systemctl</span> <span class="n">status</span> <span class="n">ceph</span><span class="o">-</span><span class="n">osd</span><span class="nd">@OSD_NUMBER</span>
</pre></div>
</div>
<p>修正所有丢失的对象:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --op fix-lost
</pre></div>
</div>
<p>修正指定归置组内、所有丢失的对象:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID --op fix-lost
</pre></div>
</div>
<p>根据标识符修正一个丢失的对象:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --op fix-lost $OBJECT_ID
</pre></div>
</div>
<p>修正以前丢失的对象:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --op fix-lost
</pre></div>
</div>
</section>
<section id="id8">
<h3>修改一个对象的内容<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h3>
<ol class="arabic">
<li><p>确保目标 OSD 处于停机状态:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl status ceph-osd@$OSD_NUMBER
</pre></div>
</div>
</li>
<li><p>通过罗列此 OSD 或归置组内的对象找到要修改的对象。</p></li>
<li><p>在对象中写入字节串之前，先做此对象的备份和工作副本。下面是此命令的语法格式:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT get-bytes &gt; $OBJECT_FILE_NAME
</pre></div>
</div>
</li>
</ol>
<p>例如:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; get-bytes &gt; zone_info.default.backup</span>

<span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; get-bytes &gt; zone_info.default.working-copy</span>
</pre></div>
</div>
<p>第一个命令创建了备份副本，而第二个命令创建的是工作副本。</p>
<ol class="arabic" start="4">
<li><p>编辑工作副本那个对象文件。</p></li>
<li><p>填入此对象的变更字节:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT set-bytes &lt; $OBJECT_FILE_NAME
</pre></div>
</div>
</li>
</ol>
<p>例如:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; set-bytes &lt; zone_info.default.working-copy</span>
</pre></div>
</div>
</section>
<section id="id9">
<h3>对象的删除<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h3>
<p>用 <strong>ceph-objectstore-tool</strong> 删除对象。对象被删除后，其内容以及引用都会从归置组（ PG ）删除。</p>
<p>删除一个对象（语法）:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT remove
</pre></div>
</div>
<p>删除一个对象（实例）:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; remove</span>
</pre></div>
</div>
</section>
<section id="id10">
<h3>罗列对象图<a class="headerlink" href="#id10" title="Permalink to this heading"></a></h3>
<p>用 ceph-objectstore-tool 罗列对象图（ OMAP ）的内容。其输出是一系列键名。</p>
<ol class="arabic">
<li><p>确认此 OSD 处于停机状态：</p>
<p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl status ceph-osd@$OSD_NUMBER
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># systemctl status ceph-osd@1</span>
</pre></div>
</div>
</li>
<li><p>罗列其对象图：</p>
<p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT list-omap
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; list-omap</span>
</pre></div>
</div>
</li>
</ol>
</section>
<section id="omap">
<h3>修改 OMAP 的头部<a class="headerlink" href="#omap" title="Permalink to this heading"></a></h3>
<p><strong>ceph-objectstore-tool</strong> 工具可以按键值对输出 OMAP 头部。</p>
<section id="id11">
<h4>必备条件<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h4>
<blockquote>
<div><ul class="simple">
<li><p>有 Ceph OSD 节点的 root 权限</p></li>
<li><p>停掉 ceph-osd 守护进程</p></li>
</ul>
</div></blockquote>
</section>
<section id="id12">
<h4>流程<a class="headerlink" href="#id12" title="Permalink to this heading"></a></h4>
<p>确保目标 OSD 处于停机状态：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl status ceph-osd@$OSD_NUMBER
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># systemctl status ceph-osd@1</span>
</pre></div>
</div>
</div></blockquote>
<p>取出 omap 头：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT get-omaphdr &gt; $OBJECT_MAP_FILE_NAME
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39;  get-omaphdr &gt; zone_info.default.omaphdr.txt</span>
</pre></div>
</div>
</div></blockquote>
<p>设置 omap 头：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT get-omaphdr &lt; $OBJECT_MAP_FILE_NAME
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39;  set-omaphdr &lt; zone_info.default.omaphdr.txt</span>
</pre></div>
</div>
</div></blockquote>
</section>
</section>
<section id="id13">
<h3>修改 OMAP 的某个键<a class="headerlink" href="#id13" title="Permalink to this heading"></a></h3>
<p>使用 <strong>ceph-objectstore-tool</strong> 工具更改 OMAP 键，
你得提供数据路径、归置组标识符（ PG ID ）、对象、和 OMAP 的键名。</p>
<section id="id14">
<h4>必备条件<a class="headerlink" href="#id14" title="Permalink to this heading"></a></h4>
<blockquote>
<div><ul class="simple">
<li><p>有 Ceph OSD 节点的 root 权限</p></li>
<li><p>停掉 ceph-osd 守护进程</p></li>
</ul>
</div></blockquote>
</section>
<section id="id15">
<h4>命令、流程<a class="headerlink" href="#id15" title="Permalink to this heading"></a></h4>
<p>在 OSD 节点上以 <code class="docutils literal notranslate"><span class="pre">root</span></code> 身份执行命令。</p>
<ul>
<li><p><strong>获取 OMAP 键</strong></p>
<blockquote>
<div><p>语法：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="na">ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT get-omap $KEY &gt; $OBJECT_MAP_FILE_NAME</span>
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">objectstore</span><span class="o">-</span><span class="n">tool</span> <span class="o">--</span><span class="n">data</span><span class="o">-</span><span class="n">path</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">osd</span><span class="o">/</span><span class="n">ceph</span><span class="o">-</span><span class="mi">0</span> <span class="o">--</span><span class="n">pgid</span> <span class="mf">0.1</span><span class="n">c</span> <span class="s1">&#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39;</span>  <span class="n">get</span><span class="o">-</span><span class="n">omap</span> <span class="s2">&quot;&quot;</span> <span class="o">&gt;</span> <span class="n">zone_info</span><span class="o">.</span><span class="n">default</span><span class="o">.</span><span class="n">omap</span><span class="o">.</span><span class="n">txt</span>
</pre></div>
</div>
</div></blockquote>
</li>
<li><p><strong>设置此 OMAP 键</strong></p>
<blockquote>
<div><p>语法：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="na">ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT set-omap $KEY &lt; $OBJECT_MAP_FILE_NAME</span>
</pre></div>
</div>
<p>实例：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">objectstore</span><span class="o">-</span><span class="n">tool</span> <span class="o">--</span><span class="n">data</span><span class="o">-</span><span class="n">path</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">osd</span><span class="o">/</span><span class="n">ceph</span><span class="o">-</span><span class="mi">0</span> <span class="o">--</span><span class="n">pgid</span> <span class="mf">0.1</span><span class="n">c</span> <span class="s1">&#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39;</span> <span class="nb">set</span><span class="o">-</span><span class="n">omap</span> <span class="s2">&quot;&quot;</span> <span class="o">&lt;</span> <span class="n">zone_info</span><span class="o">.</span><span class="n">default</span><span class="o">.</span><span class="n">omap</span><span class="o">.</span><span class="n">txt</span>
</pre></div>
</div>
</div></blockquote>
</li>
<li><p><strong>删除这个 OMAP 键</strong></p>
<blockquote>
<div><p>语法：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="na">ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT rm-omap $KEY</span>
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">objectstore</span><span class="o">-</span><span class="n">tool</span> <span class="o">--</span><span class="n">data</span><span class="o">-</span><span class="n">path</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">osd</span><span class="o">/</span><span class="n">ceph</span><span class="o">-</span><span class="mi">0</span> <span class="o">--</span><span class="n">pgid</span> <span class="mf">0.1</span><span class="n">c</span> <span class="s1">&#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39;</span> <span class="n">rm</span><span class="o">-</span><span class="n">omap</span> <span class="s2">&quot;&quot;</span>
</pre></div>
</div>
</div></blockquote>
</li>
</ul>
</section>
</section>
<section id="id16">
<h3>罗列一个对象的属性<a class="headerlink" href="#id16" title="Permalink to this heading"></a></h3>
<p>用 <strong>ceph-objectstore-tool</strong> 工具罗列某一对象的属性。其输出是此对象的键名和值。</p>
<section id="id17">
<h4>必备条件<a class="headerlink" href="#id17" title="Permalink to this heading"></a></h4>
<blockquote>
<div><ul class="simple">
<li><p>有 Ceph OSD 节点的 root 权限</p></li>
<li><p>停掉 ceph-osd 守护进程</p></li>
</ul>
</div></blockquote>
</section>
<section id="id18">
<h4>流程<a class="headerlink" href="#id18" title="Permalink to this heading"></a></h4>
<blockquote>
<div><p>确保目标 OSD 处于停机状态：</p>
<p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl status ceph-osd@$OSD_NUMBER
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># systemctl status ceph-osd@1</span>
</pre></div>
</div>
<p>罗列此对象的属性：</p>
<p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT list-attrs
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; list-attrs</span>
</pre></div>
</div>
</div></blockquote>
</section>
</section>
<section id="id19">
<h3>修改对象的属性键<a class="headerlink" href="#id19" title="Permalink to this heading"></a></h3>
<p>用 ceph-objectstore-tool 工具更改一个对象的属性。要修改此对象的属性，你得有数据和日志路径、归置组标识符（ PG ID ）、对象、还有对象属性的键名。</p>
<p>必备条件</p>
<blockquote>
<div><ul class="simple">
<li><p>有 Ceph OSD 节点的 root 权限</p></li>
<li><p>停掉 ceph-osd 守护进程</p></li>
</ul>
</div></blockquote>
<p>流程</p>
<p>确保目标 OSD 处于停机状态：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl status ceph-osd@$OSD_NUMBER
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># systemctl status ceph-osd@1</span>
</pre></div>
</div>
</div></blockquote>
<p>获取此对象的属性：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT get-attrs $KEY &gt; $OBJECT_ATTRS_FILE_NAME
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0  --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; get-attrs &quot;oid&quot; &gt; zone_info.default.attr.txt</span>
</pre></div>
</div>
</div></blockquote>
<p>设置一个对象的属性：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT  set-attrs $KEY &lt; $OBJECT_ATTRS_FILE_NAME
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; set-attrs &quot;oid&quot; &lt; zone_info.default.attr.txt</span>
</pre></div>
</div>
</div></blockquote>
<p>删除对象属性：</p>
<blockquote>
<div><p>语法:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ceph-objectstore-tool --data-path $PATH_TO_OSD --pgid $PG_ID $OBJECT rm-attrs $KEY
</pre></div>
</div>
<p>实例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">root</span><span class="nd">@osd</span> <span class="o">~</span><span class="p">]</span><span class="c1"># ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c &#39;{&quot;oid&quot;:&quot;zone_info.default&quot;,&quot;key&quot;:&quot;&quot;,&quot;snapid&quot;:-2,&quot;hash&quot;:235010478,&quot;max&quot;:0,&quot;pool&quot;:11,&quot;namespace&quot;:&quot;&quot;}&#39; rm-attrs &quot;oid&quot;</span>
</pre></div>
</div>
</div></blockquote>
</section>
</section>
<section id="id20">
<h2>选项<a class="headerlink" href="#id20" title="Permalink to this heading"></a></h2>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-help">
<span class="sig-name descname"><span class="pre">--help</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-help" title="Permalink to this definition"></a></dt>
<dd><p>输出帮助消息</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-type">
<span class="sig-name descname"><span class="pre">--type</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-type" title="Permalink to this definition"></a></dt>
<dd><p>参数 arg 是 [bluestore (默认的), filestore, memstore] 其中之一。此工具不能确定 --data-path 的类型时需要加此选项。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-data-path">
<span class="sig-name descname"><span class="pre">--data-path</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-data-path" title="Permalink to this definition"></a></dt>
<dd><p>对象存储器的路径，必备参数；</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-journal-path">
<span class="sig-name descname"><span class="pre">--journal-path</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-journal-path" title="Permalink to this definition"></a></dt>
<dd><p>日志路径，此工具找不到时需要加。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-pgid">
<span class="sig-name descname"><span class="pre">--pgid</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-pgid" title="Permalink to this definition"></a></dt>
<dd><p>PG id，对 info, log, remove, export, export-remove, mark-complete, trim-pg-log 命令是必备。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-pool">
<span class="sig-name descname"><span class="pre">--pool</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-pool" title="Permalink to this definition"></a></dt>
<dd><p>存储池名字</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-op">
<span class="sig-name descname"><span class="pre">--op</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-op" title="Permalink to this definition"></a></dt>
<dd><p>参数 arg 是 [info, log, remove, mkfs, fsck, repair, fuse, dup, export, export-remove, import, list, fix-lost, list-pgs, dump-super, meta-list, get-osdmap, set-osdmap, get-superblock, set-superblock, get-inc-osdmap, set-inc-osdmap, mark-complete, reset-last-complete, update-mon-db, dump-export, trim-pg-log] 其中之一。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-epoch">
<span class="sig-name descname"><span class="pre">--epoch</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-epoch" title="Permalink to this definition"></a></dt>
<dd><p>为 get-osdmap 和 get-inc-osdmap 指定 epoch 号，如果没指定就用当前的 epoch 号。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-file">
<span class="sig-name descname"><span class="pre">--file</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-file" title="Permalink to this definition"></a></dt>
<dd><p>export, export-remove, import, get-osdmap, set-osdmap, get-inc-osdmap 或  set-inc-osdmap 操作所需的文件路径。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-mon-store-path">
<span class="sig-name descname"><span class="pre">--mon-store-path</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-mon-store-path" title="Permalink to this definition"></a></dt>
<dd><p>update-mon-db 所需的 monstore 路径。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-fsid">
<span class="sig-name descname"><span class="pre">--fsid</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-fsid" title="Permalink to this definition"></a></dt>
<dd><p>mkfs 新建存储的 fsid 。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-target-data-path">
<span class="sig-name descname"><span class="pre">--target-data-path</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-target-data-path" title="Permalink to this definition"></a></dt>
<dd><p>目标对象存储器的路径（ --op dup 需要）。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-mountpoint">
<span class="sig-name descname"><span class="pre">--mountpoint</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-mountpoint" title="Permalink to this definition"></a></dt>
<dd><p>fuse 挂载点。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-format">
<span class="sig-name descname"><span class="pre">--format</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span> <span class="pre">(=json-pretty)</span></span><a class="headerlink" href="#cmdoption-format" title="Permalink to this definition"></a></dt>
<dd><p>输出格式，可以是 json, json-pretty, xml, xml-pretty</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-debug">
<span class="sig-name descname"><span class="pre">--debug</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-debug" title="Permalink to this definition"></a></dt>
<dd><p>让诊断信息输出到 stderr 。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-force">
<span class="sig-name descname"><span class="pre">--force</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-force" title="Permalink to this definition"></a></dt>
<dd><p>忽略某些类型的错误、并继续操作 - <strong>慎用：可能损坏数据，现在或将来都是！</strong></p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-skip-journal-replay">
<span class="sig-name descname"><span class="pre">--skip-journal-replay</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-skip-journal-replay" title="Permalink to this definition"></a></dt>
<dd><p>禁用日志重放。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-skip-mount-omap">
<span class="sig-name descname"><span class="pre">--skip-mount-omap</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-skip-mount-omap" title="Permalink to this definition"></a></dt>
<dd><p>禁用 omap 的挂载。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-head">
<span class="sig-name descname"><span class="pre">--head</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-head" title="Permalink to this definition"></a></dt>
<dd><p>按名字搜索对象时也去 head 、 snapdir 里找。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-dry-run">
<span class="sig-name descname"><span class="pre">--dry-run</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-dry-run" title="Permalink to this definition"></a></dt>
<dd><p>不要真的修改 objectstore</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-namespace">
<span class="sig-name descname"><span class="pre">--namespace</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-namespace" title="Permalink to this definition"></a></dt>
<dd><p>搜索对象时指定命名空间。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-rmtype">
<span class="sig-name descname"><span class="pre">--rmtype</span></span><span class="sig-prename descclassname"> <span class="pre">arg</span></span><a class="headerlink" href="#cmdoption-rmtype" title="Permalink to this definition"></a></dt>
<dd><p>已损坏对象删除时指定 ‘snapmap’ 或是 ‘nosnapmap’ - <strong>仅用于测试</strong></p>
</dd></dl>

</section>
<section id="id21">
<h2>错误码<a class="headerlink" href="#id21" title="Permalink to this heading"></a></h2>
<p>“Mount failed with ‘(11) Resource temporarily unavailable” - 可能是你试图在一个运行着的 OSD 上运行 <strong>ceph-objectstore-tool</strong> 。</p>
</section>
<section id="id22">
<h2>使用范围<a class="headerlink" href="#id22" title="Permalink to this heading"></a></h2>
<p><strong>rgw-orphan-list</strong> 是 Ceph 的一部分，这是个伸缩力强、开源、
分布式的存储系统，更多信息参见 <a class="reference external" href="https://docs.ceph.com">https://docs.ceph.com</a> 。</p>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>